const state = {
  approve: {
    visible: false,
    documentid: '',
    modelcode: ''
  },
  approveInsert: {
    visible: false,
    title: '',
    documentid: '',
    historyid: 0,
    modelcode: ''
  },
  upload: {
    visible: false,
    documentid: '',
    modelcode: ''
  },
  export: {
    visible: false,
    documentid: '',
    modelcode: ''
  },
  approveClose: false,
  approveIClose: false,
  uploadClose: false,
  approveList: {
    InComeApply: '/bofu/shenqing/',
    LocalReceive: '/shouru/feijingfei/',
    InComeFund: '/shouru/jingfei/',
    SwapMain: '/huanhui/index/',
    BX_RateApply: '/huilv/index/',
    ExcessiveFee: '/chaobiao/feiyong/',
    ExcessiveGift: '/chaobiao/lipin/',
    FixedAssets: '/feiyong/zichan/',
    FixedAssetsDis: '/feiyong/chuzhi/',
    ExpensedOther: '/feiyong/zhichu/',
    ExpensedTour: '/feiyong/chailv/',
    OrgCar: '/feiyong/cheliang/',
    ComRetBack: '/jinianpin/tuihui/',
    InComInput: '/jinianpin/renling/',
    WorkDate: '/kaoqin/dengji/',
    PayForSb: '/daishoudaifu/index/',
    PayForSb2: '/daishoudaifu/index3/',
    MonthReport: '/tongjibaobiao/details/',
    CW_BUDGET: '/yvsuan/details/',
    CW_BUDGETMODIFY: '/yvsuan/details/',
    CashCheck: '/hexiaoguanli/pandian/',
    BankCheck: '/hexiaoguanli/duizhang/',
    FixCheck: '/hexiaoguanli/zichan/',
    QuarterReport: '/hexiaoguanli/hexiao/',
    DBProject: '/Fourth/text'
  }
}

const mutations = {
  SET_APPROVE: (state, status) => {
    state.approve = status
  },
  SET_APPROVEINSERT: (state, status) => {
    state.approveInsert = status
  },
  SET_UPLOAD: (state, status) => {
    state.upload = status
  },
  SET_EXPORT: (state, status) => {
    state.export = status
  },
  SET_APPROVECLOSE: (state, status) => {
    state.approveClose = status
  },
  SET_APPROVEICLOSE: (state, status) => {
    state.approveIClose = status
  },
  SET_UPLOADCLOSE: (state, status) => {
    state.uploadClose = status
  }
}

const actions = {
  getApprove({ commit }, data) {
    commit('SET_APPROVE', data)
    commit('SET_APPROVECLOSE', false)
  },
  getApproveInsert({ commit }, data) {
    commit('SET_APPROVEINSERT', data)
    commit('SET_APPROVECLOSE', false)
  },
  getExport({ commit }, data) {
    commit('SET_EXPORT', data)
  },
  getUpload({ commit }, data) {
    commit('SET_UPLOAD', data)
    commit('SET_UPLOADCLOSE', false)
  },

  approveClose({ commit }, boolean) {
    commit('SET_APPROVE', {
      visible: false,
      documentid: '',
      modelcode: ''
    })
    if (boolean == true) {
      commit('SET_APPROVECLOSE', true)
    } else {
      commit('SET_APPROVECLOSE', false)
    }
  },
  approveInsertReset({ commit }) {
    commit('SET_APPROVEICLOSE', false)
  },
  approveInsertClose({ commit }, boolean) {
    commit('SET_APPROVEINSERT', {
      visible: false,
      title: '',
      documentid: '',
      historyid: 0,
      modelcode: ''
    })
    if (boolean == true) {
      commit('SET_APPROVEICLOSE', true)
    } else {
      commit('SET_APPROVEICLOSE', false)
    }
  },
  uploadClose({ commit }, boolean) {
    commit('SET_UPLOAD', {
      visible: false,
      documentid: '',
      modelcode: ''
    })
    if (boolean == true) {
      commit('SET_UPLOADCLOSE', true)
    } else {
      commit('SET_UPLOADCLOSE', false)
    }
  }
}

export default {
  namespaced: true,
  state,
  mutations,
  actions
}
